#include "Grammar.h"

#include "CProduction_Expression.h"
#include "Expression.h"
#include "Unit.h"
#include "Variable.h"
#include "Expression_Assign.h"
#include "Expression_Plus.h"
#include "Expression_Minus.h"
#include "Expression_Mult.h"
#include "Expression_Divide.h"
#include "Expression_Nagetive.h"


CTokenPtr CProduction_Expression_Copy::Reduce( CProductionArgPtr pArgs )
{
    return pArgs->getArg<CExpression>(0);
}

CTokenPtr CProduction_Expression_Assign::Reduce( CProductionArgPtr pArgs )
{
	return CExpression_Assign::create(
		pArgs->getArg<CVariable>(0), pArgs->getArg<CExpression>(2));
}



CTokenPtr CProduction_Expression_Plus::Reduce( CProductionArgPtr pArgs )
{
    return CExpression_Plus::create(
		pArgs->getArg<CExpression>(0), pArgs->getArg<CExpression>(2));
}


CTokenPtr CProduction_Expression_Minus::Reduce( CProductionArgPtr pArgs )
{
	return CExpression_Minus::create(
		pArgs->getArg<CExpression>(0), pArgs->getArg<CExpression>(2));
}

CTokenPtr CProduction_Expression_Mult::Reduce( CProductionArgPtr pArgs )
{
	return CExpression_Mult::create(
		pArgs->getArg<CExpression>(0), pArgs->getArg<CExpression>(2));
}

CTokenPtr CProduction_Expression_Divide::Reduce( CProductionArgPtr pArgs )
{
	return CExpression_Divide::create(
		pArgs->getArg<CExpression>(0), pArgs->getArg<CExpression>(2));
}

CTokenPtr CProduction_Expression_Nagetive::Reduce( CProductionArgPtr pArgs )
{
	return CExpression_Nagetive::create(
		pArgs->getArg<CExpression>(1));
}

CTokenPtr CProduction_Expression_ParentThese::Reduce( CProductionArgPtr pArgs )
{
    return pArgs->getArg<CExpression>(1);
}